#include "CvtColorEffect.h"

#include "Poco/Exception.h"
#include <stdlib.h>
#include <iostream>
using Poco::Exception;
using cv::cvtColor;

using namespace std;

CvtColorEffect::CvtColorEffect(string code)
{
    // Only one valid option
    if(code!="CV_RGB2GRAY")
        throw Exception(string("CvtColorEffect unknown code value: ") + code);
    this->code = CV_RGB2GRAY;
}

Mat CvtColorEffect::run(const Mat& src)
{
    cout << "Running CvtColorEffect" << endl;
    Mat output;
    cvtColor(src, output, this->code);
    return output;
}